import React from 'react'
import {AjaxSend} from '../../util/util'
import './AwardImg.css'
import AwardImg_bg from './background.png'
class AwardImg extends React.Component{
    constructor(props){
        super(props);
        this.state = {
            AwardData:0
        }

    }
    componentDidMount() {
       var  _this=this
      this.getProductAwardData()
      var timer = setInterval(function() {
        _this.getProductAwardData()

    }, 30000)
    }

    getProductAwardData(){
        const data={
            _cmd: 'user_get_bonus_pool'
        }
        AjaxSend(data, (da) =>  {
            this.setState({
                AwardData:da.data.bonus_pool
            })
        }, (errors)  => {
            alert(errors);
        })
    }
    handleClick(index,url){

     
    }

    render() {

        return (
            <div
            style={{
                width:'7.24rem',
                height:'1.88rem',
                backgroundImage: 'url(' + AwardImg_bg + ')', 
                backgroundSize:'7.24rem 1.88rem',
                margin:'0 auto',
                display:'flex',
                display:'-webkit-flex',
                flexDirection:'column',
                justifyContent:'center',
                alignItems:'center'
            }}
            >
               <div
               style={{
                    color:'white',
                    fontSize:'0.64rem'   ,
                    display:'flex',
                    display:'-webkit-flex',
                    alignItems:'flex-start'
                }}
               ><span
               style={{
                  color:'white',
                  fontSize:'0.24rem' ,
                  lineHeight:'0.5rem'  
                }}
               >￥</span>
               <span
               >{this.state.AwardData}</span></div>
               <div
               style={{
                  color:'#f7ff00',
                  fontSize:'0.32rem'   
                }}
               >加入VIP共享千万消费奖励</div>
            </div>
        )
    }

}

export default AwardImg